// import { StateMachine, State } from "../StateMachine";
// import { core, getGameObjectById, TextRenderer, SpriteRenderer } from "../gameengine";
// import { MainRoleBehaviour } from "../rect/MainRoleBehaviour";
// import { AnimationRenderer } from "./Animitation";
// //import { AnimationRenderer } from "../zch/Animitation";
// /**
//  * 
//  * 千万不要忘记在切换状态时修改MainRole里面的mainrolestate属性！！！！！！！
//  * 
//  */
// export enum MainRoleStateType {
//     CANMOVE = 0,
//     CANNOTMOVE = 1
// }
// export class MainRole extends StateMachine {
//     mainrolestate = MainRoleStateType.CANMOVE;
// }
// export class MainRoleCanMove extends State {
//     onEnter() {
//         mainrole.mainrolestate = MainRoleStateType.CANMOVE;
//         if (getGameObjectById("MainRole").getScript(MainRoleBehaviour)) {

//         }
//         else if (getGameObjectById("MainRole").getScript(MainRoleBehaviour)) {


//         }
//         else {
//             let mainrole = getGameObjectById("MainRole");
//             mainrole.addScript(new MainRoleBehaviour());
//         }

//     }
//     onExit() {

//     }
// }
// export class MainRoleCanotMove extends State {
//     onEnter() {
//         mainrole.mainrolestate = MainRoleStateType.CANNOTMOVE;
//         if (getGameObjectById("MainRole").getScript(MainRoleBehaviour)) {
//             let mainrole = getGameObjectById("MainRole");
//             let mainrolebehaviour = mainrole.getScript(MainRoleBehaviour);
//             mainrole.removeScript(mainrolebehaviour);
//         }
//         if (getGameObjectById("MainRole").getScript(MainRoleBehaviour)) {
//             let mainrole = getGameObjectById("MainRole");
//             let onlymainrolebehaviour = mainrole.getScript(MainRoleBehaviour);
//             mainrole.removeScript(onlymainrolebehaviour);
//         }
//     }
//     onExit() {

//     }
// }
// export class MainRoleLeft extends State {
//     onEnter() {
//         if (mainrole.mainrolestate == MainRoleStateType.CANMOVE) {
//             const leftimage = new SpriteRenderer();
//             leftimage.imageName = "assets/左/1.png"
//             getGameObjectById("MainRole").addScript(leftimage);
//         }
//     }
//     onExit() {

//     }
// }
// export class MainRoleRight extends State {
//     onEnter() {
//         if (mainrole.mainrolestate == MainRoleStateType.CANMOVE) {
//             const rightimage = new SpriteRenderer();
//             rightimage.imageName = "assets/右/1.png"
//             getGameObjectById("MainRole").addScript(rightimage);
//         }
//     }
//     onExit() {

//     }
// }
// export class MainRoleTop extends State {
//     onEnter() {
//         if (mainrole.mainrolestate == MainRoleStateType.CANMOVE) {
//             const topimage = new SpriteRenderer();
//             topimage.imageName = "assets/前/1.png"
//             getGameObjectById("MainRole").addScript(topimage);
//         }
//     }
//     onExit() {
//     }
// }
// export class MainRoleBottom extends State {
//     onEnter() {
//         if (mainrole.mainrolestate == MainRoleStateType.CANMOVE) {
//             const bottomimage = new SpriteRenderer();
//             bottomimage.imageName = "assets/后/1.png"
//             getGameObjectById("MainRole").addScript(bottomimage);
//         }
//     }
//     onExit() {
//     }
// }
// export class MainRoleMovingLeft extends State {
//     onEnter() {
//         if (mainrole.mainrolestate == MainRoleStateType.CANMOVE) {
//             const leftrunimage = new AnimationRenderer();
//             leftrunimage.filepath = "assets/左/"
//             leftrunimage.config = 2;
//             getGameObjectById("MainRole").addScript(leftrunimage);
//         }
//     }
//     onExit() {
//         if (getGameObjectById("MainRole").getScript(AnimationRenderer)) {
//             const mainrole = getGameObjectById("MainRole");
//             const runscript = mainrole.getScript(AnimationRenderer);
//             mainrole.removeScript(runscript);
//         }

//     }
// }
// export class MainRoleMovingRight extends State {
//     onEnter() {
//         if (mainrole.mainrolestate == MainRoleStateType.CANMOVE) {
//             const rightrunimage = new AnimationRenderer();
//             rightrunimage.filepath = "assets/右/"
//             rightrunimage.config = 2;
//             getGameObjectById("MainRole").addScript(rightrunimage);
//         }
//     }
//     onExit() {
//         if (getGameObjectById("MainRole").getScript(AnimationRenderer)) {
//             const mainrole = getGameObjectById("MainRole");
//             const runscript = mainrole.getScript(AnimationRenderer);
//             mainrole.removeScript(runscript);
//         }
//     }
// }
// export class MainRoleMovingTop extends State {
//     onEnter() {
//         if (mainrole.mainrolestate == MainRoleStateType.CANMOVE) {
//             const toprunimage = new AnimationRenderer();
//             toprunimage.filepath = "assets/前/";
//             toprunimage.config = 2;
//             getGameObjectById("MainRole").addScript(toprunimage);
//         }
//     }
//     onExit() {
//         if (getGameObjectById("MainRole").getScript(AnimationRenderer)) {
//             const mainrole = getGameObjectById("MainRole");
//             const runscript = mainrole.getScript(AnimationRenderer);
//             mainrole.removeScript(runscript);
//         }
//     }
// }
// export class MainRoleMovingBottom extends State {
//     onEnter() {
//         if (mainrole.mainrolestate == MainRoleStateType.CANMOVE) {
//             const bottomrunimage = new AnimationRenderer();
//             bottomrunimage.filepath = "assets/后/";
//             bottomrunimage.config = 2;
//             getGameObjectById("MainRole").addScript(bottomrunimage);
//         }
//     }
//     onExit() {
//         if (getGameObjectById("MainRole").getScript(AnimationRenderer)) {
//             const mainrole = getGameObjectById("MainRole");
//             const runscript = mainrole.getScript(AnimationRenderer);
//             mainrole.removeScript(runscript);
//         }
//     }
// }

// export const mainrole = new MainRole();